# Maintainer: Will Sinatra <wpsinatra@gmail.com>
# Contributor: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-docile
_gemname=${pkgname#ruby-}
pkgver=1.4.1
pkgrel=0
pkgdesc="Ruby DSL creation gem"
url="https://rubygems.org/gems/docile"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rake ruby-bundler ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/ms-ati/docile/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
subpackages="$pkgname-doc"
options="!check" #depends on simplecov

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake spec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc

	install -Dm644 "$builddir"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

sha512sums="
4c87155b062de8863e153d58725d8f84ac0a58bc11a88dd1f49e61f6bb7d89f177a9df96c5310a6a83c82b0af3f43a7c49fa33670cfde3925b86f4d77e1e2c95  ruby-docile-1.4.1.tar.gz
256552b7dad2ada30736a1029a06d323630fdf9ec2ccf714af8f1c839458c9ece7d22143893f7ed4a3ec63284e874f5eaa1f7b78c10cda280e2546c47bc78016  gemspec.patch
"
